package org.phoenixframework.api.teacher.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.phoenixframework.api.teacher.message.MessageSender;
import org.phoenixframework.common.tools.ResultModel;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 *
 * @author doublelifeke
 * Email: hautxxxyzjk@163.com
 * DateTime: 2021/7/4 17:21
 * Description:
 */
@Slf4j
@Api(tags = {"订单控制器"})
@AllArgsConstructor
@RestController
@RequestMapping("/omsOrder")
public class OmsOrderController {

    private final MessageSender messageSender;

    @ApiOperation("根据购物车信息生成订单")
    @PostMapping("/generateOrder")
    public ResultModel<?> generateOrder() {
        // 这里模拟发送 获取订单超时时间，假设为30秒
        long delayTimes = 30 * 1000;
        //发送延迟消息
        messageSender.sendMessage(11L, delayTimes);
        return ResultModel.ok("下单成功");
    }
}
